<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>菜鸟教程 React 实例-ajax请求</title>
    <script src="https://cdn.bootcss.com/react/15.4.2/react.min.js"></script>
  <script src="https://cdn.bootcss.com/react/15.4.2/react-dom.min.js"></script>
  <script src="https://cdn.bootcss.com/babel-standalone/6.22.1/babel.min.js"></script>
  <script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
  </head>
 <body>
    <div id="example"></div>
    <!-- babel javascript -->
    <script type="text/babel">
    var InputTest = React.createClass({
      getInitialState: function() {
        return {
          value:'Hello EastNews',
        }
      },
      handleChange: function(event) {
        this.setState({value:event.target.value});
      },
      render: function() {
        var value = this.state.value;
        return (
          <div>
            <InputComponent myDataProp={value} updateStateProp={this.handleChange} />
          </div>
          )
      }
    });
    var InputComponent = React.createClass({
      render: function() {
        return (
          <div>
            <input type="text" value={this.props.myDataProp} onChange={this.props.updateStateProp}/>
            <h4>{this.props.myDataProp}</h4>
          </div>
          )
      }

    })
    ReactDOM.render(
      <InputTest />,
      document.getElementById('example')
    )
    </script>
  </body>
</html>